package com.yzk.train.member.controller.admin;

import com.yzk.train.common.request.MemberTicketReq;
import com.yzk.train.common.response.PageResp;
import com.yzk.train.common.response.Result;
import com.yzk.train.member.request.TicketQueryReq;
import com.yzk.train.member.response.TicketQueryResp;
import com.yzk.train.member.service.TicketService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/ticket")
public class TicketAdminController {

    @Resource
    private TicketService ticketService;

    @PostMapping("/save")
    public Result<Object> save(@Valid @RequestBody MemberTicketReq req) {
        ticketService.save(req);
        return Result.okMessage("保存成功");
    }

    @GetMapping("/list")
    public Result<PageResp<TicketQueryResp>> queryList(@Valid TicketQueryReq req) {
        PageResp<TicketQueryResp> pageResp = ticketService.queryList(req);
        return Result.ok(pageResp);
    }

}
